﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FastMath;
using PocketEngine.Engine;
using PocketEngine.Geometry;
namespace PocketEngine.Gui
{
    public class pWindowFrame : pWidget
    {
        public string Text
        {
            get
            {
                return mText;
            }
            set
            {
                mText = value;
            }
        }
        private string mText = null;


        public pWindowFrame(int x, int y, int w, int h, string title, pWidget parent)
        {
            Set(x, y, w, h, parent);
            Text = Text;
            TitleBar = new pButton(1, 1, Width - 52, 16, title, this);
            MiniBar = new pButton(Width - 50, 1, 16, 16, "_", this);
            MaxBar = new pButton(Width - 32, 1, 16, 16, "-", this);
            CloseBar = new pButton(Width - 15, 1, 16, 16, "X", this);
            //        UpdateBody();

        }
        public pButton TitleBar;
        public pButton MiniBar;
        public pButton MaxBar;
        public pButton CloseBar;
        public void UpdateBody()
        {
            Body = new pTriangles();

            Body.AddPoint(0, 20);
            Body.AddPoint(20, 0);
            Body.AddPoint(Width-20, 0);
            Body.AddPoint(Width, 20);

            Body.AddPoint(Width, Height - 20);
            Body.AddPoint(Width - 20, Height);
            Body.AddPoint(20, Height);
            Body.AddPoint(0, Height - 20);
            Body.AddPoint(0, 20);
            Body.ConvertToTris();
        }
        public override void Draw(int dx,int dy)
        {
//            _Rect(dx, dy, Width, Height, pColor.White, pColor.LightBlue);
            _Frame(dx, dy, Width, Height, new pColor(0.82f, 0.82f, 0.85f, 0.85f), new pColor(0.63f, 0.63f, 0.66f, 0.85f));
            //Body.QuickDraw(dx, dy);
        }
    }
}
